<template>
	<view class="">
		<navbar background="background-image: linear-gradient(to right, #2c6739, #99c043);"
			title="卡券/团购" back @onBack="goBack" @topTotalHeight="topTotalHeight"
		></navbar>
		<scroll-view scroll-x="true" class="whSpaNow backColWhite lh88r f28r teAliCenter borB1SE6e6e6">
			<view @click="cliTopList(index)" v-for="(item, index) in topList" :key="index"
				:class="['wPer33S333333', 'disInBlo', 'poRel',
					nowCurrent == index ? 'foWeiBold col99c043' : ''
				]"
			>
				{{item}}
				<text class="w50r h4r backCol99c043 poAbs bom0 left50P trTrXn50P"
					v-show="nowCurrent == index"
				></text>
			</view>
		</scroll-view>
		<swiper @change="swiperChaFun" :current="nowCurrent"
			:style="'height: ' + 'calc(100vh - ' + calcNum + 'px);'"
		>
			<swiper-item class="overYS">
				<view class="disFlex colFff teAliCenter lh90r">
					<view class="flex1 backCol73b0b3" @click="cliUsedBtn">
						已使用列表
					</view>
					<view class="flex1 backColF7d347"
						@click="goUrl('/pages/personalCenter/exchangeCenter')"
					>
						美团卡券兑换
					</view>
				</view>
			</swiper-item>
			<swiper-item class="overYS">
				<view class="disFlex colFff teAliCenter lh90r">
					<view class="flex1 backCol73b0b3" @click="cliUsedBtn">
						已使用列表
					</view>
					<view class="flex1 backColF7d347"
						@click="goUrl('/pages/personalCenter/exchangeCenter')"
					>
						抖音团购兑换
					</view>
				</view>
			</swiper-item>
			<swiper-item class="overYS">
				<view class="disFlex colFff teAliCenter lh90r">
					<view class="flex1 backCol73b0b3" @click="cliUsedBtn">
						已使用列表
					</view>
					<view class="flex1 backColF7d347"
						@click="goUrl('/pages/personalCenter/exchangeCenter')"
					>
						优惠券兑换
					</view>
				</view>
			</swiper-item>
		</swiper>
	</view>
</template>
<script>
import navbar from '@/components/navbar.vue'
export default {
	components: { navbar },
	data() {
		return {
			calcNum: 0,
			topList: ['美团卡券', '抖音团购', '优惠券'], nowCurrent: 0,
		}
	},
	onLoad(options) {
		console.log(options)
		if(options.type) this.nowCurrent = options.type;
		// uni.showModal({
		// 	title: '正在开发中...',
		// 	content: '后续开放此功能...',
		// 	confirmColor: '#99c043', showCancel: false, confirmText: '我知道了',
		// 	success:res1 => {
		// 		if (res1.confirm) {
					
		// 		}
		// 	}
		// })
	},
	onShow() {
		
	},
	methods: {
		goBack() {
			uni.navigateBack();
		},
		topTotalHeight(height) {
			// #ifdef MP-WEIXIN
				this.calcNum = height + 45;
			// #endif
			// #ifdef H5
				this.calcNum = 45;
			// #endif
		},
		cliTopList(type) {
			if(type != this.nowCurrent) {
				this.nowCurrent = type;
			}
		},
		swiperChaFun(eee) {
			if (eee.detail.source == 'touch') {
				this.nowCurrent = eee.detail.current;
			}
		},
		cliUsedBtn() {
			uni.showToast({
				title: '该功能暂未开放', icon: 'none', duration: 3000
			})
		},
		goUrl(url) {
			uni.navigateTo({ url })
		},
	}
}
</script>
<style>
</style>